package org.achartengine.internal.a;

import org.achartengine.internal.chart.k;
import org.achartengine.internal.model.h;

/* loaded from: classes2.dex */
public class b extends a {
    public b(k kVar) {
        super(kVar);
    }

    public void b() {
        if (this.a.f() == null) {
            return;
        }
        if (this.b.ag()) {
            this.b.c(this.b.ah());
            return;
        }
        h[] b = this.a.f().b();
        int length = b.length;
        if (length > 0) {
            double[] dArr = {b[0].d(), b[0].f(), Math.min(this.a.b(), b[0].e()), b[0].g()};
            for (int i = 1; i < length; i++) {
                dArr[0] = Math.min(dArr[0], b[i].d());
                dArr[1] = Math.max(dArr[1], b[i].f());
                dArr[2] = Math.min(dArr[2], b[i].e());
                dArr[3] = Math.max(dArr[3], b[i].g());
            }
            double abs = Math.abs(dArr[1] - dArr[0]) / 40.0d;
            double abs2 = Math.abs(dArr[3] - dArr[2]) / 40.0d;
            this.b.c(new double[]{dArr[0] - abs, dArr[1] + abs, dArr[2] - abs2, dArr[3] + abs2});
        }
    }
}
